<?php
session_start();
include '../conn.php';
$uid=$_REQUEST['uid'];

$sql = "SELECT * FROM user where id = '".$uid."'";
$result = $conn->query($sql);

if ($result->num_rows <= 0) {

echo '请先注册或登录！';
exit;
  }

?>
<!DOCTYPE>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>修改信息</title>
  <link rel="stylesheet" type="text/css" href="../css/general.css">
  <link rel="stylesheet" type="text/css" href="../css/index.css">
    <link rel="stylesheet" type="text/css" href="../css/table.css">
  <script type="text/javascript" src="../js/jquery.js"></script>
  <script type="text/javascript" src="../js/general.js"></script>
  <script type="text/javascript" src="../js/carousel.js"></script>
</head>
<body>
<!-- 顶部开始 -->
<!-- 头部开始 -->
<div class="header-body">
    <!-- 头部开始 -->
    <?php include 'header.php'; ?>
    <!-- 头部结束 -->
</div>
<!-- 头部结束 -->
<!-- 主体开始 -->
<div class="container w1100">
    <br>  <br>  <br>  <br>
    <p style="font-size: 30px; text-align: center;">个人信息修改</p>
    <?php
    while ($row = $result->fetch_assoc()) {
    ?>
        <form class="" action="doedituserinfo.php?uid=<?php echo $uid ?>" method="post">
            <table style="width: 50%; margin: 0 auto; border-collapse: collapse; background-color: #fff; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
                <tr>
                    <td style="padding: 10px; border: 1px solid #ddd; text-align: right;">用户名：</td>
                    <td style="padding: 10px; border: 1px solid #ddd;"><input type="text" name="username" value="<?php echo htmlspecialchars($row['uname']); ?>" style="width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px;"></td>
                </tr>
                <tr>
                    <td style="padding: 10px; border: 1px solid #ddd; text-align: right;">密码：</td>
                    <td style="padding: 10px; border: 1px solid #ddd;"><input type="password" name="password" value="<?php echo htmlspecialchars($row['pwd']); ?>" style="width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px;"></td>
                </tr>
                <tr>
                    <td style="padding: 10px; border: 1px solid #ddd; text-align: right;">手机号：</td>
                    <td style="padding: 10px; border: 1px solid #ddd;"><input type="text" name="tel" value="<?php echo htmlspecialchars($row['tel']); ?>" style="width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px;"></td>
                </tr>
                <tr>
                    <td style="padding: 10px; border: 1px solid #ddd; text-align: right;">性别：</td>
                    <td style="padding: 10px; border: 1px solid #ddd;">
                        <select name="sex" style="width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px;">
                            <option value="0" <?php echo $row['sex'] == 0 ? 'selected' : ''; ?>>女</option>
                            <option value="1" <?php echo $row['sex'] == 1 ? 'selected' : ''; ?>>男</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="padding: 10px; border: 1px solid #ddd; text-align: right;">邮箱：</td>
                    <td style="padding: 10px; border: 1px solid #ddd;"><input type="text" name="email" value="<?php echo htmlspecialchars($row['email']); ?>" style="width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px;"></td>
                </tr>
                <tr>
                    <td style="padding: 10px; border: 1px solid #ddd; text-align: right;">地址：</td>
                    <td style="padding: 10px; border: 1px solid #ddd;">
                        <input type="text" name="address" value="<?php echo htmlspecialchars($row['address']); ?>" style="width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px;">
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="padding: 10px; text-align: center;">
                        <input type="submit" name="" value="更新" style="padding: 10px 20px; border: none; border-radius: 4px; background-color: #1369C0; color: #fff; cursor: pointer; transition: background-color 0.3s;">
                    </td>
                </tr>
            </table>
        </form>
    <?php
    }
    ?>
</div>
<!-- 页脚开始 -->
<div style="margin-top: 50px; background-color: #f9f9f9;  text-align: center;">
    <?php include '../footer.php'; ?>
</div>
<!-- 页脚结束 -->